<template>
  <bar-chart :chart-data="yearBillStat" title="年支出" />
</template>
<script>

import BarChart from './BarChart'

import { getYearStat } from '@/api/invest/bill-report'

import { centToYuan } from '@/utils'

export default {
  name: 'YearBarChart',
  components: { BarChart },
  data() {
    return {
      yearBillStat: []
    }
  },
  mounted() {
    this.getYearStat()
  },
  methods: {
    getYearStat() {
      getYearStat(new Date().getFullYear()).then(res => {
        const { data } = res

        this.yearBillStat = [centToYuan(data.expend), centToYuan(data.income)]
      })
    }
  }
}
</script>
<style>
</style>
